<template>
  <div></div>
</template>

<script>
function myAjax() {
  return new Promise(function (resolve, reject) {
    const xhr = new XMLHttpRequest();
    xhr.open("get", "http://123.57.109.30:3006/api/getbooks");
    xhr.send();
    xhr.onload = function () {
      if (xhr.status === 200) {
        let res = JSON.parse(xhr.responseText);
        resolve(res);
      } else {
        reject(xhr.status);
      }
    };
  });
}
export default {
  created() {
    myAjax()
      .then((res) => {
        console.log(res);
      })
      .catch((err) => {
        console.log(err);
      });
  },
};
</script>

<style>
</style>